﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 外观模式
{

    /// <summary>
    /// 电脑启动过程，包括启动电源、主板、硬盘、操作系统。。但 用户只需“按下电源开关”即可。
    /// </summary>
    class Program
    {
        static void Main(string[] args)
        {
            //只需针对 按下电源开源 编程即可
            PressPower pressPower = new PressPower();
            pressPower.startPower();
            Console.ReadLine();
        }
    }

    //上面4个子步骤
    class Power
    {
       public void Connect()
        {
            Console.WriteLine( "启动电源！");
        }
    }
    class MainBoard
    {
        public void On()
        {
            Console.WriteLine("启动主板！");
        }
    }
    class HardDisk
    {
        public void Run()
        {
            Console.WriteLine("启动硬盘！");
        }
    }
    class OS
    {
        public void Starttup()
        {
            Console.WriteLine("启动操作系统");
        }
    }

    class PressPower
    {
        Power power;
        MainBoard mainBoard;
        HardDisk handDisk;
        OS os;
        public PressPower()
        {
            power = new Power();
            mainBoard = new MainBoard();
            handDisk = new HardDisk();
            os = new OS();
        }
        public void startPower()
        {
            power.Connect();
            mainBoard.On();
            handDisk.Run();
            os.Starttup();
        }
    }
}
